
#include "intext.h"
#include "handwrite.h"
#include "rw_config.h"
//无模式窗口  
//#define SCHEMALESS_WINDOW  
int instr_callback(gchar *instr)  
{  
    

    GtkWidget *dialog;      
    GtkWidget *entry; 
    GtkWidget *bt_ok;
    GtkBuilder *builder;
    gint result;  
    char instrUI[256];

    sprintf(instrUI,"%s/default.glade",getThemeDir());
    builder=gtk_builder_new(); 
    if(!gtk_builder_add_from_file(builder, instrUI, NULL)){  
                printf("cannot load UI file!\n");              
            }

    //dialog = gtk_dialog_new_with_buttons("请输入",shuoxie->window,GTK_DIALOG_MODAL,GTK_STOCK_OK,GTK_RESPONSE_OK,NULL);  

    
    
    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "intext_dialog"));  
    bt_ok=GTK_WIDGET(gtk_builder_get_object(builder,"intext_ok"));
    entry=GTK_WIDGET(gtk_builder_get_object(builder,"in_entry"));
    
     
     //设置缺省按钮  
    gtk_dialog_add_action_widget(dialog,bt_ok,GTK_RESPONSE_OK);
    gtk_dialog_set_default_response(GTK_DIALOG(dialog),GTK_RESPONSE_OK);     
    //gtk_widget_show_all(dialog);  
  
    g_object_unref(G_OBJECT(builder)); 
    //运行和输出对话框  
    result = gtk_dialog_run(GTK_DIALOG(dialog));  
  
    switch(result){  
        case GTK_RESPONSE_NONE:  
            
            break;  
        case GTK_RESPONSE_REJECT:  
           
            break;  
        case GTK_RESPONSE_ACCEPT:  
            
            break;  
        case GTK_RESPONSE_DELETE_EVENT:  
             
            break;  
              
        case GTK_RESPONSE_OK:  
            
            sprintf(instr,"%s",gtk_entry_get_text(GTK_ENTRY(entry)));
            //printf("%s\n",instr);
             break;  
        case GTK_RESPONSE_CANCEL:  
              
            g_print("cancel is press!\n");  
  
            break;  
        case GTK_RESPONSE_CLOSE:  
             
            break;  
        case GTK_RESPONSE_YES:  
            
            break;  
        case GTK_RESPONSE_NO:  
             
            break;  
        case GTK_RESPONSE_APPLY:  
            
            break;  
        case GTK_RESPONSE_HELP:  
            
            break;  
        default:  
            g_print("something wrong!\n");  
  
            break;  
    }  
    gtk_widget_destroy(dialog);  
    //printf("%s\n",instr);
    
  return result;
  
}  
  
